#include <iostream>
using std::cout;
using std::endl;

class Base {
public:
    Base(long base)
    : _base(base)
    {}

    void print() const{
        cout << "Base::_base:" << _base << endl;
    }

private:
    long _base;
};

class Derived
: public Base 
{
public:
    Derived(long base,long derived)
    : Base(base)
    , _derived(derived)
    {}


    /* Derived(const Derived & rhs) */
    /* : Base(rhs)//显式调用基类拷贝构造 */
    /* , _derived(rhs._derived) */
    /* { */
    /*     cout << "Derived拷贝构造" << endl; */
    /* } */

    /* Derived & operator=(const Derived & rhs){ */
    /*     cout << "Derived赋值运算符函数" << endl; */
    /*     Base::operator=(rhs);//显式调用基类赋值运算符函数 */
    /*     _derived = rhs._derived; */
    /*     return *this; */
    /* } */


    void print() const{
        Base::print();
        cout << "Derived::_derived:" << _derived << endl;
    }
private:
    long _derived;
};


void test0(){
    Derived d1(2,5);
    Derived d2 = d1;
    d2.print();

    Derived d3(6,7);
    d1 = d3;
    d1.print();
}

int main(void){
    test0();
    return 0;
}
